export const optionA = {
  // visualMap: {
  //     min: 0,
  //     max: 50,
  //     text:['High','Low'],
  //     textStyle:{
  //         color:'#fff'
  //     },
  //     realtime: false,
  //     calculable: true,
  //     inRange: {
  //         color: ['lightskyblue','yellow', 'orangered']
  //     }
  // },
  series: [
    {
      name: '宏泰地图',
      type: 'map',
      map: 'chinaCity',
      label: {
        normal: {
          show: true,
          color: '#fff',
          fontSize: 12
        },
        emphasis: {
          show: true,
          color: '#fff',
          fontSize: 12
        }
      },
      emphasis: {
        itemStyle: {
          areaColor: '#70EAF4', // 高亮时候地图显示的颜色
          borderWidth: 1 // 高亮时的边框宽度
        },
        label: {
          fontSize: 12, // 选中地图文字字号和字体颜色
          color: '#fff'
        }
      },
      itemStyle: {
        borderColor: '#17caf0', //地图各块的边框颜色
        borderWidth: 1, //地图各块的边框
        borderType: 'solid',
        areaColor: {
          x: 0.5,
          y: 0.7,
          r: 0.5,
          colorStops: [
            {
              offset: 0,
              color: '#2A72D7'
            },
            {
              offset: 1,
              color: '#51A1FB'
            }
          ],
          global: false // 缺省为 false
        }
      },
      data: [
        { name: '福州市', value: 11 },
        { name: '厦门市', value: 14 },
        { name: '莆田市', value: 31 },
        { name: '三明市', value: 6 },
        { name: '泉州市', value: 0 },
        { name: '漳州市', value: 0 },
        { name: '南平市', value: 3 },
        { name: '龙岩市', value: 4 },
        { name: '宁德市', value: 5 }
      ]
    }
  ]
}

export const geoCoordMap = {
  翔安厂: [118.22, 24.72],
  宏泰文创园: [117.96, 24.58],
  漳州厂: [117.92, 24.28]
}
export const data = [
  { name: '宏泰文创园', value: 89 },
  { name: '翔安厂', value: 69 },
  { name: '漳州厂', value: 69 }
]
export const max = 480
export const min = 9 // todo
export const maxSize4Pin = 100
export const minSize4Pin = 20

export const convertData = function (data) {
  var res = []
  for (var i = 0; i < data.length; i++) {
    var geoCoord = geoCoordMap[data[i].name]
    if (geoCoord) {
      res.push({
        name: data[i].name,
        value: geoCoord.concat(data[i].value)
      })
    }
  }
  return res
}
export const optionB = {
  title: {
    text: '宏泰地图',
    subtext: '',
    x: 'center',
    textStyle: {
      color: '#ccc'
    }
  },
  geo: {
    show: true,
    map: 'chinaCity',
    label: {
      normal: {
        show: false
      },
      emphasis: {
        show: false
      }
    },
    roam: true,
    emphasis: {
      itemStyle: {
        areaColor: '#70EAF4', // 高亮时候地图显示的颜色
        borderWidth: 1 // 高亮时的边框宽度
      },
      label: {
        fontSize: 12, // 选中地图文字字号和字体颜色
        color: '#fff'
      }
    },
    itemStyle: {
      borderColor: '#17caf0', //地图各块的边框颜色
      borderWidth: 1, //地图各块的边框
      borderType: 'solid',
      areaColor: {
        x: 0.5,
        y: 0.7,
        r: 0.5,
        colorStops: [
          {
            offset: 0,
            color: '#005cc0'
          },
          {
            offset: 1,
            color: '#51A1FB'
          }
        ],
        global: false // 缺省为 false
      },
      normal: {
        areaColor: 'rgba(0,255,255,.10)',
        borderColor: '#4fecec',
        borderWidth: 1.5,
        shadowColor: '#0cacac',
        shadowOffsetX: 0,
        shadowOffsetY: 4,
        shadowBlur: 15
      },
      emphasis: {
        areaColor: 'transparent', //悬浮背景
        textStyle: {
          color: '#fff'
        }
      }
    }
  },
  series: [
    {
      name: 'credit_pm2.5',
      type: 'scatter',
      coordinateSystem: 'geo',
      data: convertData(data),
      symbolSize: function (val) {
        return val[2] / 10
      },
      label: {
        normal: {
          formatter: '{b}',
          position: 'right',
          show: true
        },
        emphasis: {
          show: true
        }
      },
      itemStyle: {
        normal: {
          color: '#05C3F9'
        }
      }
    },
    {
      type: 'map',
      map: 'chinaCity',
      geoIndex: 0,
      aspectScale: 0.75, //长宽比
      showLegendSymbol: false, // 存在legend时显示
      label: {
        normal: {
          show: false
        },
        emphasis: {
          show: false,
          textStyle: {
            color: '#fff'
          }
        }
      },
      roam: true,
      animation: false,
      data: data
    },
    {
      name: '点',
      type: 'scatter',
      coordinateSystem: 'geo',
      symbol: 'pin',
      symbolSize: 40,
      label: {
        normal: {
          show: false
        }
      },
      itemStyle: {
        normal: {
          color: '#F62157' //标志颜色
        }
      },
      zlevel: 6,
      data: convertData(data)
    },
    {
      name: 'Top 5',
      type: 'effectScatter',
      coordinateSystem: 'geo',
      data: convertData(data),
      symbolSize: function (val) {
        return val[2] / 10
      },
      showEffectOn: 'render',
      rippleEffect: {
        brushType: 'stroke'
      },
      hoverAnimation: true,
      label: {
        normal: {
          formatter: '{b}',
          position: 'right',
          show: true
        }
      },
      itemStyle: {
        normal: {
          color: '#05C3F9',
          shadowBlur: 10,
          shadowColor: '#05C3F9'
        }
      },
      zlevel: 1
    }
  ]
}

export const optionC = {
  title: {
    text: '宏泰地图',
    subtext: '',
    x: 'center',
    textStyle: {
      color: '#ccc'
    }
  },
  tooltip: {
    trigger: 'item',
    formatter: function (params) {
      if (typeof params.value[2] == 'undefined') {
        return params.name + ' : ' + params.value
      } else {
        return params.name + ' : ' + params.value[2]
      }
    }
  },
  legend: {
    orient: 'vertical',
    y: 'bottom',
    x: 'right',
    data: ['credit_pm2.5'],
    textStyle: {
      color: '#fff'
    }
  },
  visualMap: {
    show: false,
    min: 0,
    max: 500,
    left: 'left',
    top: 'bottom',
    text: ['高', '低'], // 文本，默认为数值文本
    calculable: true,
    seriesIndex: [1],
    inRange: {
      // color: ['#3B5077', '#031525'] // 蓝黑
      // color: ['#ffc0cb', '#800080'] // 红紫
      // color: ['#3C3B3F', '#605C3C'] // 黑绿
      color: ['#0f0c29', '#302b63', '#24243e'] // 黑紫黑
      // color: ['#23074d', '#cc5333'] // 紫红
      // color: ['#00467F', '#A5CC82'] // 蓝绿
      // color: ['#1488CC', '#2B32B2'] // 浅蓝
      // color: ['#00467F', '#A5CC82'] // 蓝绿
      // color: ['#00467F', '#A5CC82'] // 蓝绿
      // color: ['#00467F', '#A5CC82'] // 蓝绿
      // color: ['#00467F', '#A5CC82'] // 蓝绿
    }
  },
  // toolbox: {
  //     show: true,
  //     orient: 'vertical',
  //     left: 'right',
  //     top: 'center',
  //     feature: {
  //             dataView: {readOnly: false},
  //             restore: {},
  //             saveAsImage: {}
  //             }
  // },
  geo: {
    show: true,
    map: 'chinaCity',
    label: {
      normal: {
        show: false
      },
      emphasis: {
        show: false
      }
    },
    roam: true,
    itemStyle: {
      normal: {
        areaColor: '#031525',
        borderColor: '#3B5077'
      },
      emphasis: {
        areaColor: '#2B91B7'
      }
    }
  },
  series: [
    {
      name: 'credit_pm2.5',
      type: 'scatter',
      coordinateSystem: 'geo',
      data: convertData(data),
      symbolSize: function (val) {
        return val[2] / 10
      },
      label: {
        normal: {
          formatter: '{b}',
          position: 'right',
          show: true
        },
        emphasis: {
          show: true
        }
      },
      itemStyle: {
        normal: {
          color: '#05C3F9'
        }
      }
    },
    {
      type: 'map',
      map: 'chinaCity',
      geoIndex: 0,
      aspectScale: 0.75, //长宽比
      showLegendSymbol: false, // 存在legend时显示
      label: {
        normal: {
          show: false
        },
        emphasis: {
          show: false,
          textStyle: {
            color: '#fff'
          }
        }
      },
      roam: true,
      itemStyle: {
        normal: {
          areaColor: '#031525',
          borderColor: '#3B5077'
        },
        emphasis: {
          areaColor: '#2B91B7'
        }
      },
      animation: false,
      data: data
    },
    {
      name: '点',
      type: 'scatter',
      coordinateSystem: 'geo',
      symbol: 'pin',
      symbolSize: 40,
      label: {
        normal: {
          show: false
        }
      },
      itemStyle: {
        normal: {
          color: '#F62157' //标志颜色
        }
      },
      zlevel: 6,
      data: convertData(data)
    },
    {
      name: 'Top 5',
      type: 'effectScatter',
      coordinateSystem: 'geo',
      data: convertData(data),
      symbolSize: function (val) {
        return val[2] / 10
      },
      showEffectOn: 'render',
      rippleEffect: {
        brushType: 'stroke'
      },
      hoverAnimation: true,
      label: {
        normal: {
          formatter: '{b}',
          position: 'right',
          show: true
        }
      },
      itemStyle: {
        normal: {
          color: '#05C3F9',
          shadowBlur: 10,
          shadowColor: '#05C3F9'
        }
      },
      zlevel: 1
    }
  ]
}
